<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 30px;
            height: 30px;
            background: palegreen;
            text-align: center;
            line-height: 30px;
            position: absolute;
        }
    </style>
</head>
<body>
    <script>
        var arr1 = []
        for(var i=1;i<=30;i++){
            var div = document.createElement('div');
            div.innerHTML = i
            document.body.appendChild(div);
            arr1.push(div)
        }
        // console.log(arr1)
        document.onmousemove = function(e){
            e = e || window.event
            for(var i=arr1.length-1;i>0;i--){
                arr1[i].style.left = arr1[i-1].style.left;
                arr1[i].style.top = arr1[i-1].style.top;
                
            }
            arr1[0].style.left = e.clientX + 'px';
            arr1[0].style.top = e.clientY + 'px';
        }
    </script>
</body>
</html>